ARG VERSION
FROM elastic/elasticsearch:${VERSION}

ARG VERSION
# ik分词器
# ADD ./ik.tar /usr/share/elasticsearch/plugins/
RUN echo "y" | elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v${VERSION}/elasticsearch-analysis-ik-${VERSION}.zip

# 拼音分词器
RUN echo "y" | elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v${VERSION}/elasticsearch-analysis-pinyin-${VERSION}.zip

ADD IKAnalyzer.cfg.xml /usr/share/elasticsearch/config/analysis-ik/

# 动态同义词
ADD ./dynamic-synonym-${VERSION}.tar /usr/share/elasticsearch/plugins/

# 注册备份用的地址
RUN echo -e 'path.repo: ["/back"]' >> /usr/share/elasticsearch/config/elasticsearch.yml
RUN mkdir /back && chown elasticsearch:elasticsearch /back
